草庐IT

postgresql - Docker Compose 和 Postgres : Name does not resolve

全部标签

ruby-on-rails - 尝试使用 Rails 和 PostgreSQL 生成模型时,命令挂起且没有错误

当使用这个命令时:rails生成模型事件名称:字符串没有任何反应,我必须按CTRL+c。我使用的版本是:ruby2.1.1p76rails4.1.0PostgreSQL9.3.4MacOSX10.9.3我已验证Postgres正在运行,我可以通过运行psqleasyEventTracker_development连接到它。我通过运行railsneweasyEventTracker-dpostgresql来设置我的Rails项目运行rakedb:create时,我收到以下消息:easyEventTracker_developmentalreadyexistseasyEventTracke

ruby-on-rails - Rails 3.2 Postgres 保存错误 "ActiveRecord::StatementInvalid: PG::Error: ERROR: Syntax error near ' T' 在位置 5"

当我尝试将特定类保存到数据库时,我的应用开始抛出错误。我不确定到底是什么原因导致这种情况开始发生-过去几天我一直遇到各种数据库问题....无论如何,我的模型似乎工作正常(它正在正确计算所有before_save值),但随后它尝试保存到数据库并爆炸。SQL(0.8ms)INSERTINTO"portfolios"("correlation_matrix","created_at","data","mean_return","std_dev","updated_at","weights")VALUES($1,$2,$3,$4,$5,$6,$7)RETURNING"id"[["correla

ruby - 请安装 postgresql 适配器 : `gem install activerecord-postgresql-adapter`

这个问题在这里已经有了答案:关闭11年前。PossibleDuplicate:HowtohandleRubyonRailserror:“Pleaseinstallthepostgresqladapter:`geminstallactiverecord-postgresql-adapter'”我正在尝试让Redmine与postgres一起工作。在我的日志中,我不断看到。Pleaseinstallthepostgresqladapter:`geminstallactiverecord-postgresql-adapter`在谷歌搜索之后,每个人都说你需要做geminstallpg。但是当

ruby-on-rails - Rails Migration 更改列以使用 Postgres 数组

我正在尝试更改数据库中的列,以便它可以使用Postgres数组数据类型。目前表列是字符串类型。我正在使用以下迁移来转换它:defchangechange_column:table,:dummy_column,:text,array:true,default:[]end但是我得到以下错误:bundleexecrakedb:migraterakeaborted!Anerrorhasoccurred,thisandalllatermigrationscanceled:PG::Error:ERROR:column"dummy_column"cannotbecastautomaticallyto

ruby-on-rails - 我可以在 Ruby on Rails 上编写 PostgreSQL 函数吗?

我们正在启动一个基于RubyonRails的项目。我们曾经使用Perl和PostgreSQL函数,使用Rails和ActiveRecord我还没有看到我们应该如何在PostgreSQL中创建函数并使用ActiveRecord和模型保存记录。我知道我们可以在PostgreSQL中手动创建它,但ActiveRecord的“魔力”在于可以使用所有模型重新创建数据库。有什么方法可以使用Rails创建PostgreSQL函数并将其保存在模型中吗? 最佳答案 这部分问题:IknowwecancreateitmanuallyinPostgreSQ

ruby-on-rails - Rails 5 如何清除或删除生产 postgres 数据库

我正在尝试删除生产数据库,以便重新开始。当我从rails4升级到rails5时,它现在正在保护生产数据库不被意外删除。它在我运行rakedb:reset时显示以下错误消息。/app#rakedb:resetActiveRecord::SchemaMigrationLoad(1.8ms)SELECT"schema_migrations".*FROM"schema_migrations"(1.6ms)SELECT"ar_internal_metadata"."value"FROM"ar_internal_metadata"WHERE"ar_internal_metadata"."key"=

我不仅需要一排postgresql

我需要一个可以返回比一行更多的后Ql子查询。这是我到目前为止的查询部分:select(SELECTARRAY[url,thumb_1,thumb_200,thumb_500]FROM"Image"LEFTJOIN"Product_Image"ON"Image".id="Product_Image".image_idWHERE"Product_Image".product_id=517ORDERBY"Product_Image".sortASC)asimages看答案将子查询放在FROM条款?selectvalsfrom(SELECTARRAY[url,thumb_1,thumb_200,thu

ruby-on-rails - 升级到 OSX Mavericks 后修复 postgresql

最近升级到OSXMavericks中断了我的Rails应用程序的数据库连接。当我尝试从数据库中获取数据时,服务器返回以下错误:PG::ConnectionBad(couldnotconnecttoserver:ConnectionrefusedIstheserverrunningonhost"localhost"(::1)andacceptingTCP/IPconnectionsonport5432?couldnotconnecttoserver:ConnectionrefusedIstheserverrunningonhost"localhost"(127.0.0.1)andacce

ruby-on-rails - 尝试为 ror 应用程序设置 postgres,出现错误 - fe_sendauth : no password supplied

获得:Anerrorhasoccurred:Errorconnectingtotheserver:fe_sendauth:nopasswordsupplieddatabase.yml中的设置与其他机器上的应用设置相同。我如何设置才能不需要硬编码密码?我可以使用PgAdmin-III查看数据库。我宁愿不要在database.yml中设置密码,因为使用此应用程序的其他机器没有/不需要密码,所以这似乎与我的Pg安装有关。 最佳答案 您需要更改您的pg_hba.conf。这是我的一个例子:pg_hba.conf:TYPEDATABASEUS

ruby-on-rails - PostgreSQL gem pg 无法安装

我的数据库是PostgreSQL。我在CENTOS上...。在安装pggem时,我收到以下错误。我也重新安装以清除我的YAML问题,但没有用,但这只是一个警告。我的主要问题是pggem的安装:[root@vdimc04~]#geminstallpg/usr/local/lib/ruby/1.9.1/yaml.rb:56:in`':Itseemsyourrubyinstallationismissingpsych(forYAMLoutput).Toeliminatethiswarning,pleaseinstalllibyamlandreinstallyourruby.Buildingn